import redis
import logging

class Config(object):
    DEBUG = False

    SECRET_KEY = 'dongjingyuan'

    # mysql
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:123456@127.0.0.1:3306/ihome_python04'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # redis
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    # session
    SESSION_TYPE = 'redis'
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    SESSION_USE_SIGNER = True  # 对cookie中session_id进行影藏处理
    PERMANENT_SESSION_LIFETIME = 86400 # session数据的有效期

    # 设置日志级别
    LEVEL_NAME = logging.DEBUG

class Development(Config):
    DEBUG = True

class Production(Config):
    DEBUG = False
    # 设置日志级别
    LEVEL_NAME = logging.ERROR

config_dict = {
    'dev':Development,
    'pro':Production
}